package com.xing.oauth.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.xing.oauth.domain.LightUser;
import com.xing.oauth.service.LightUserService;
import com.xing.oauth.mapper.LightUserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class LightUserServiceImpl extends ServiceImpl<LightUserMapper, LightUser>
        implements LightUserService {

    @Autowired
    private LightUserMapper lightUserMapper;

    /**
     * 校验客户端id是否正确
     *
     * @param clientId
     * @return
     */
    @Override
    public LightUser findByClientId(String clientId) {
        LightUser lightUser = lightUserMapper.findByClientId(clientId);
        if (null == lightUser) {
            return null;
        }

        //为了测试这个功能所以这个实体类就不创建啦，直接用数据库里面的对象
        //进行浅拷贝，把你数据库对象拷贝到目标对象
//        LightUserResult lightUserResult = new LightUserResult();
//        BeanUtils.copyProperties(lightUser,lightUserResult);
        return lightUser;
    }
}
